// 190.颠倒二进制位
package Leetcode_Second_Brush;

public class Solution190 {
    // you need treat n as an unsigned value
    public int reverseBits(int n) {
        int result = 0;
        while (n != 0) {
            int lastbit = n & 1;
            n >>>= 1;
            result = result & lastbit;
            result <<= 1;
        }
        return result;
    }
}
